home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / tool / artemis1 / src / font12.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-11  |  1.1 KB  |  62 lines

  1. /*
  2.     font12.c
  3.  
  4.     12ドットフォントの表示高速化
  5. */
  6.  
  7. #include <stdio.h>
  8. #include <string.h>
  9. #include <ctype.h>
  10. #include <stdlib.h>
  11. #include <egb.h>
  12. #include <mos.h>
  13.  
  14. #include "ge.h"
  15. #include "plt16.h"
  16. #include "imageman.h"
  17. #include "dispman.h"
  18.  
  19. // extern int        font12seg;                // 12dot font が存在するセグメント
  20. static char *ankbuf;
  21.  
  22.  
  23. static char *getankbutptr(char c)
  24. {
  25.     return ankbuf + (int)(c - 32)*12*4;
  26. }
  27.  
  28.  
  29. int font12_new()
  30. {
  31.     extern int mma_allocSeg(char* segname);
  32.     font12seg = mma_allocSeg("FONT");
  33.     if ((ankbuf = malloc(4*12*(128-32)) == NULL)
  34.         return -1;
  35.     int i;
  36.     for (i=32; i<=127; i++)
  37.     {
  38.         int ds = getds();
  39.         int ofs = (int)*str * 12;
  40.         char fontbuf[12];
  41.         _movedata(font12seg, ofs, ds, fontbuf, 12);
  42.         int j,k;  int *p = (int*)getankbufptr(i);
  43.         *p = 0;  static char bit[] = {128,64,32,16,8,4,2,1};
  44.         for (j=0; j<12; j++,p++)
  45.         {
  46.             for (k=0; k<6; k++)
  47.             {
  48.                 if (fontbuf[j] & bit[k])
  49.                     *p |= (15 << (4 * k));
  50.             }
  51.         }
  52.     }
  53.     return 0;
  54. }
  55.  
  56.  
  57. void font12_delete()
  58. {
  59.     mma_freeSeg(font12seg);
  60.     free(ankbuf);
  61. }
  62.